// FrogImageResizeDialog.h : Declaration of the CFrogImageResizeDialog

#pragma once

#include "resource.h"       // main symbols
#include <atlhost.h>
#include "FrogProgressReportDialog.h"


// CFrogImageResizeDialog

class CFrogImageResizeDialog: public CFrogProgressReportDialog<CFrogImageResizeDialog>,
	public CWinDataExchange<CFrogImageResizeDialog>
{
public:

	enum { IDD = IDD_DIALOG_SHRINK_IMAGE };

	CFrogImageResizeDialog(HICON hIcon);

	int m_ShrinkBy;
	int m_Width;
	int m_Height;
	int m_Quality;
	int m_ResizePercent;
	bool m_SaveAsJpg;
	bool m_ChangeSaveQuality;
	bool m_PutInFolder;

	BEGIN_MSG_MAP(CFrogImageResizeDialog)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		COMMAND_HANDLER(IDOK, BN_CLICKED, OnClickedOK)
		COMMAND_HANDLER(IDCANCEL, BN_CLICKED, OnClickedCancel)
		COMMAND_HANDLER(IDC_RADIO_PERCENT, BN_CLICKED, OnRadioPercentBnClicked)
		COMMAND_HANDLER(IDC_RADIO_CUSTOM_WH, BN_CLICKED, OnRadioCustomWhBnClicked)
		COMMAND_HANDLER(IDC_CHECK_QUALITY, BN_CLICKED, OnCheckQualityBnClicked)
		COMMAND_HANDLER(IDC_CHECK_PUT_IN_FOLDER, BN_CLICKED, OnCheckPutInFolderBnClicked)
		NOTIFY_ID_HANDLER(IDC_SLIDER_PERCENT, OnSliderPercentChange)
		NOTIFY_ID_HANDLER(IDC_SLIDER_QUALITY, OnSliderQualityChange)
		// FrogBaseDialog Inherited
		CHAIN_MSG_MAP(CFrogProgressReportDialog)
	END_MSG_MAP()

	BEGIN_DDX_MAP(CFrogImageResizeDialog)
		DDX_INT(IDC_EDIT_WIDTH, m_Width)
		DDX_INT(IDC_EDIT_HEIGHT, m_Height)
		DDX_TEXT(IDC_EDIT_FOLDER, m_Folder)		
		DDX_RADIO(IDC_RADIO_PERCENT, m_ResizePercent)
		DDX_CHECK(IDC_CHECK_QUALITY, m_ChangeSaveQuality)
		DDX_CHECK(IDC_CHECK_JPG, m_SaveAsJpg)
		DDX_CHECK(IDC_CHECK_PUT_IN_FOLDER, m_PutInFolder)
	END_DDX_MAP()

	// Handler prototypes:
	//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	virtual void ExecuteCommand();

private:
	CEdit m_EditWidth;
	CEdit m_EditHeight;

	CStatic m_LabelWidth;
	CStatic m_LabelHeight;

	CEdit m_EditFolder;
	CString m_Folder;

	CTrackBarCtrl m_SliderQuality;
	CTrackBarCtrl m_SliderPercent;

	CButton m_RadioPercent;
	CButton m_RadioSize;

	CButton m_CheckBoxQuality;
	CButton m_CheckBoxPutInFolder;
	CButton m_CheckBoxSaveAsJpeg;

public:
	LRESULT OnRadioPercentBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnRadioCustomWhBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnCheckQualityBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnCheckPutInFolderBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);	
	LRESULT OnSliderPercentChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnSliderQualityChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

private:
	void EnableDisableControls();
};


